package login

import (
	"context"
	"fitness/rpc/proto/user"
	"fitness/service/server"
)

type UserServer struct {
	user.UnimplementedUserServer
}

func (u UserServer) UserRegister(ctx context.Context, in *user.UserRegisterReq) (*user.UserRegisterResp, error) {
	register, err := server.UserRegister(in)
	if err != nil {
		return nil, err
	}
	return register, nil
}

func (u UserServer) UserLogin(ctx context.Context, in *user.UserLoginReq) (*user.UserLoginResp, error) {
	login, err := server.UserLogin(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserServer) FitnessCreate(ctx context.Context, in *user.FitnessCreateReq) (*user.FitnessCreateResp, error) {
	create, err := server.FitnessCreate(in)
	if err != nil {
		return nil, err
	}
	return create, nil
}

func (u UserServer) FitnessList(ctx context.Context, in *user.FitnessListReq) (*user.FitnessListResp, error) {
	list, err := server.FitnessList(in)
	if err != nil {
		return nil, err
	}
	return list, nil
}

func (u UserServer) FitnessLike(ctx context.Context, in *user.FitnessLikeReq) (*user.FitnessListResp, error) {
	like, err := server.FitnessLike(in)
	if err != nil {
		return nil, err
	}
	return like, nil
}
